package com.online.edu.eduservice.entity;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * @Author hlg
 * @Date 2020\3\4 0004
 * @Version V1.0
 **/
@Component
@Data
public class AliyunInfo implements InitializingBean {


    // Endpoint以杭州为例，其它Region请按实际情况填写。
    @Value("${com.aliyun.ossendpoint}")
    private String endpoint;
    // 云账号AccessKey有所有API访问权限，建议遵循阿里云安全最佳实践，创建并使用RAM子账号进行API访问或日常运维，请登录 https://ram.console.aliyun.com 创建。
    @Value("${com.aliyun.ossaccessKeyId}")
    private String accessKeyId;
    @Value("${com.aliyun.ossaccessKeySecret}")
    private String accessKeySecret;
    @Value("${com.aliyun.ossbucketName}")
    private String bucketName;


    public static String OSSENDPOINT;
    public static String OSSACCESSKEYID;
    public static String OSSACCESSKEYSECRET;
    public static String OSSBUCKETNAME;


    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println(bucketName);
        OSSENDPOINT = endpoint;
        OSSACCESSKEYID = accessKeyId;
        OSSACCESSKEYSECRET = accessKeySecret;
        OSSBUCKETNAME = bucketName;
        System.out.println(OSSENDPOINT);
        System.out.println(OSSACCESSKEYID);
        System.out.println(OSSACCESSKEYSECRET);
        System.out.println(OSSBUCKETNAME);
    }
}
